#include <cfixcc.h>
#include "ProjectHeader.h"
#include "Renderer.h"
#include "Window.h"

class Renderer_fixture : public cfixcc::TestFixture
{
private:
		HINSTANCE		hInstance;									// Holds The Instance Of the Application	
		Renderer		TestRenderer;									// Creates an instance of the Renderer class
		OpenGLInit_delegate		GLInit_d;		
		ResizeEvent_delegate	Resize_d;
		OpenGLWindow	GLWindow;	// Creates an instance of the OpenGLWindow class


public:

	//Renderer_fixture(){}

	static void SetUp()
	{
	}

	static void TearDown()
	{
	}

	void Before()
	{
		HINSTANCE		hInstance;									// Holds The Instance Of the Application	
		Renderer		TestRenderer;									// Creates an instance of the Renderer class
		OpenGLInit_delegate		GLInit_d	(	&TestRenderer,		&Renderer::InitGL);		
		ResizeEvent_delegate	Resize_d	(	&TestRenderer,		&Renderer::ReSizeGLScene);
		OpenGLWindow	GLWindow(hInstance, GLInit_d, Resize_d);	// Creates an instance of the OpenGLWindow class
	}

	void After()
	{
	}

	void InitGL_test()
	{
		CFIX_LOG(L"Creating window...");
		bool createWindowReturnCode = GLWindow.CreateGLWindow("Test running...",640,480,16,false);
		CFIX_ASSERT(createWindowReturnCode == true);
		CFIX_LOG(L"Window Created. Test Complete.\n");
	}

	void ResizeGLScene_test()
	{
		CFIX_LOG(L"Creating another window...");
		bool createWindowReturnCode = GLWindow.CreateGLWindow("Test running...",320,240,16,false);
		CFIX_ASSERT(createWindowReturnCode == true);
		Resize_d(0,0);
		CFIX_LOG(L"Resized to 0,0.\n");
		Resize_d(640, 480);
		CFIX_LOG(L"Resized to 640, 480.\n");
		CFIX_LOG(L"Test Complete.\n");
	}
};

CFIXCC_BEGIN_CLASS(Renderer_fixture)
	CFIXCC_METHOD(InitGL_test)
CFIXCC_END_CLASS()

